<?PHP

global $conf;
if($conf->a['fbenable'])
{

	$facebook = new Facebook(array(
	  'appId'  => $conf->a['fbappid'],
	  'secret' => $conf->a['fbsecret'],
	  'cookie' => true,
	));
	$fbsession = $facebook->getSession();

	$me = null;
	// Session based API call.
	if ($fbsession) {
	//	echo 'fbs';
	  try {
	    $uid = $facebook->getUser();
	    $me = $facebook->api('/me');
	  } catch (FacebookApiException $e) {
	    error_log($e);
	  }
	}

	// login or logout url will be needed depending on current user state.
	if ($me) {
	  $logoutUrl = $facebook->getLogoutUrl();
	} else {
	  $loginUrl = $facebook->getLoginUrl();
	}

	
}


?>

